<?php
class CurlAccess{

    public static function getFromCurl($server_execution_path, $folder_path){
		
		$folder_path = "folder_path=".$folder_path;
        $ch = curl_init();
        // configuration de l'URL et d'autres options
        curl_setopt($ch, CURLOPT_URL, $server_execution_path);
        curl_setopt($ch, CURLOPT_HEADER, FALSE);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER,TRUE);
        curl_setopt($ch, CURLOPT_POST, TRUE);
        curl_setopt($ch, CURLOPT_POSTFIELDS,$folder_path);
 	  
        if($curl_rt = curl_exec($ch)){
           $result= trim($curl_rt);
        }else{
           $result=curl_error($ch);
        }
        curl_close($ch);
        
        if($result != ""){            
            return $result;
        } else {
             return array("Error"=>"Error in fetching data.");
        }
    }
}
?>
